//
//  SuifangSubitemViewCell.m
//  yilutongxing
//
//  Created by T&J on 2017/6/26.
//  Copyright © 2017年 YZE. All rights reserved.
//

#import "SuifangSubitemViewCell.h"
#import <Masonry.h>

@implementation SuifangSubitemViewCell

+(CGFloat)staticHeight{
    return 60;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(void)renderUIWithText:(NSDictionary *)data{
    NSString *reftxt = data[@2];
    if (!reftxt || ![reftxt isNotEmpty]) { //若无参考值则调整项目名称垂直居中
        _refvalLabel.hidden = YES;
        //_itemnameLabel.y = (self.height-_itemnameLabel.height)/2;
    }
    _itemnameLabel.text = data[@1];
    _refvalLabel.text = reftxt;
    _unitLabel.text = data[@3];
 }

- (void)updateConstraints{
    if (self.refvalLabel.text.length==0) {
        [self.itemnameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.contentView.mas_centerY);
        }];
    }
    [super updateConstraints];
}

@end
